package pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import controller.MyJsonServiralizer;
import lombok.Data;

import java.util.Date;
@Data
//转json时，为空不输出
@JsonInclude(value =JsonInclude.Include.NON_EMPTY )
public class User {
    private int id;
    private String username;
    private String password;
    //   换属性名
    @JsonProperty(value = "gender")
    private String sex;
//    格式化数据
    @JsonFormat(pattern = "yyyy/MM/dd")
    private Date birthday;
//    数据转换自定义
    @JsonSerialize(using= MyJsonServiralizer.class)
    private Double money;
}
